package com.itboye.tbshopcar.listener;

import java.util.Timer;
import java.util.TimerTask;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.itboye.textileexpres.R;
import com.itboye.textileexpres.base.MainApplication;

public class MyToasts {
	 static Toast toasts;
		public static  void toasts(int text) {
			LayoutInflater inflater = LayoutInflater.from(MainApplication
					.getContext());
			View view = inflater.inflate(R.layout.toast, null);
			TextView textView = (TextView) view.findViewById(R.id.toast_tv);
			if ("缺少uid参数".equals(text)) {
				textView.setText("还未登录，快登录吧");
			}
			textView.setText(text);
			toasts = new Toast(MainApplication.getContext());
			toasts.setDuration(Toast.LENGTH_LONG);
			toasts.setView(view);
			final Timer timer = new Timer();
			timer.schedule(new TimerTask() {
				@Override
				public void run() {
					toasts.show();
				}
			}, 0, 3000);
			new Timer().schedule(new TimerTask() {
				@Override
				public void run() {
					toasts.cancel();
					timer.cancel();
				}
			}, 1000);
		}
	

}
